<template>
  <PageWrapper content-full-height>
    <div :class="`${prefixCls}-content`">
      <BasicForm @register="registerForm" @submit="handleSubmit" :class="`${prefixCls}-web-site`"> 
        <template #formFooter>
          <a-button :class="prefixCls + '-web-site-submit'" @click="handleSubmitBefore" type="primary" :loading="loading" style="margin-right: 0.9rem">保存</a-button>
        </template>
      </BasicForm>
    </div>
  </PageWrapper>
</template>
<script lang="ts" setup>
import { ref } from 'vue'
import { BasicForm } from '/@/components/Form/index';
import { tenantFormSchema } from '../data';
import { useConfigForm, ConfigFormProps } from '/@/views/system/configCenter/hooks/useConfigForm'
import { ConfigKey } from '/@/views/system/config/config.model';
import { PageWrapper } from '/@/components/Page';
import { useDesign } from '/@/hooks/web/useDesign';
import { initAppConfig } from '/@/utils/cache/module'
const emit = defineEmits(['query-success'])
const { prefixCls } = useDesign('config-center')

const configFromProps : ConfigFormProps = {
  configKey: ConfigKey.WEB_SITE,
  schemas: tenantFormSchema
}
const { registerForm, handleSubmit, loading } = useConfigForm(configFromProps, emit)

const handleSubmitBefore = async () => {
 await handleSubmit()
 initAppConfig()
}
</script>


<style lang="less" scoped>
@import '../style.less';
@prefix-cls: ~'@{namespace}-config-center';
.@{prefix-cls}-web-site {
  width: 750px;
  &-submit {
    margin-left: 100px;
    margin-bottom: 10px;
  }
}

</style>